{% extends "base.html" %}
{# Copyright The IETF Trust 2015-2023, All Rights Reserved #}
{% load origin %}
{% load django_bootstrap5 %}
{% block title %}Change state for {{ doc }}{% endblock %}
{% block content %}
    {% origin %}
    <h1>
        Change state
        <br>
        <small class="text-body-secondary">{{ doc }}</small>
    </h1>
    {% if state.slug == "dead" %}
        <p class="alert alert-warning my-3">
            This document is in IESG state "Dead". It is unusual to change this to
            anything other than "I-D Exists" and this should never be used as a
            replacement for Begin IESG Processing.
        </p>
    {% endif %}
    <a class="btn btn-info my-3"
       href="{% url 'ietf.doc.views_help.state_help' type="draft-iesg" %}">Help on states</a>
    <form class="mt-3" method="post">
        {% csrf_token %}
        {% bootstrap_form form %}
        {% if state and state.slug == "rfcqueue" %}
            <div class="form-text">
                <b>Note:</b> If you pull the Internet-Draft out of the
                <i>{{ state.name }}</i> state, the RFC Editor and IANA will be notified
                by email with this comment, so they can update their queues.
            </div>
        {% endif %}
        <button type="submit" class="btn btn-primary">Submit</button>
        <a class="btn btn-secondary float-end"
           href="{% url "ietf.doc.views_doc.document_main" name=doc.name %}">Back</a>
    </form>
    {% if next_states %}
        <div class="mt-3">
            <b>Or jump directly to</b>
        </div>
        {% for n in next_states %}
            <form class="d-inline" method="post">
                {% csrf_token %}
                <input type="hidden" name="state" value="{{ n.pk }}">
                <button class="btn btn-primary" type="submit">{{ n.name }}</button>
            </form>
        {% endfor %}
    {% endif %}
    {% if to_iesg_eval %}
        <div class="mt-3">
            <b>You could also jump directly to</b>
        </div>
        <form method="post">
            {% csrf_token %}
            <input type="hidden" name="state" value="{{ to_iesg_eval.pk }}">
            <button class="btn btn-warning" type="submit">{{ to_iesg_eval.name }}</button>
            But the ballot for this document has not yet been issued.
            <a class="btn btn-primary"
               href="{% url 'ietf.doc.views_ballot.ballot_writeupnotes' name=doc.name %}">
                Edit ballot text
            </a>
        </form>
    {% endif %}
    {% if prev_state %}
        <div class="mt-3">
            <b>Or revert to previous state</b>
        </div>
        <form method="post">
            {% csrf_token %}
            <input type="hidden" name="state" value="{{ prev_state.pk }}">
            <button class="btn btn-warning" type="submit">Revert to {{ prev_state.name }}</button>
        </form>
    {% endif %}
{% endblock %}